package Week6;

import java.util.*;

public class Day35 {
}

//牛客:MT8 奇数位丢弃
class Main11 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()){
            int n = in.nextInt();
            int ret = 1;
            while(ret - 1 <= n) ret *= 2;
            System.out.println(ret / 2 - 1);
        }
    }
}

//牛客:求和
class Main12 {
    public static int n , m;
    public static int sum = 0;
    public static boolean[] visits = new boolean[11];
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        dfs(1);
    }

    public static void dfs(int x){
        if(sum == m){
            for(int i = 1; i <= n; i++){
                if(visits[i]){
                    System.out.print(i+" ");
                }
            }
            System.out.println();
            return;
        }

        if(sum > m || x > n) return;

        //选择x
        sum += x;
        visits[x] = true;
        dfs(x + 1);

        //剪枝
        sum -= x;
        visits[x] = false;

        //不选择x
        dfs(x + 1);
    }
}

//牛客:HJ52 计算字符串的编辑距离
class Main13 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] a = in.next().toCharArray();
        char[] b = in.next().toCharArray();
        int n = a.length , m = b.length;

        int[][] dp = new int[n + 1][m + 1];

        //初始化
        for(int i = 1; i <= n; i++) dp[i][0] = i;
        for(int j = 1; j <= m; j++) dp[0][j] = j;

        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= m; j++){
                //如果最后一个位置相等，去得到前一个位置的最小操作数
                if(a[i - 1] == b[j - 1]) dp[i][j] = dp[i - 1][j - 1];
                    //如果最后一个位置不相等，就去得到前一个位置和s字符串和t字符串各自相差一个位置的最小值，将这个最小值加一
                else dp[i][j] = Math.min(dp[i - 1][j - 1] , Math.min(dp[i - 1][j] , dp[i][j - 1])) + 1;
            }
        }
        System.out.println(dp[n][m]);
    }
}

